package com.atstudy.redirect;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2023/1/30 15:33
 * @copyright: 博为峰
 */
public class ServletDemo01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        resp.setHeader("r01", "r01");
        PrintWriter pw = resp.getWriter();
        pw.write("r01");

        //重定向（项目路径）
//        resp.sendRedirect("/web02_war_exploded/r02");
        resp.sendRedirect("https://www.atstudy.com/");
    }
}
